package com.liqi.items.service.impl;

import com.liqi.common.utils.DateUtils;
import com.liqi.items.domain.TCfgSubject;
import com.liqi.items.mapper.TCfgSubjectMapper;
import com.liqi.items.service.ITCfgSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 主题Service业务层处理
 *
 * @author xiaoli
 * @date 2022-04-07
 */
@Service
public class TCfgSubjectServiceImpl implements ITCfgSubjectService
{
    @Autowired
    private TCfgSubjectMapper tCfgSubjectMapper;

    /**
     * 查询主题
     *
     * @param id 主题主键
     * @return 主题
     */
    @Override
    public TCfgSubject selectTCfgSubjectById(Long id)
    {
        return tCfgSubjectMapper.selectTCfgSubjectById(id);
    }

    /**
     * 查询主题列表
     *
     * @param tCfgSubject 主题
     * @return 主题
     */
    @Override
    public List<TCfgSubject> selectTCfgSubjectList(TCfgSubject tCfgSubject)
    {
        return tCfgSubjectMapper.selectTCfgSubjectList(tCfgSubject);
    }

    /**
     * 新增主题
     *
     * @param tCfgSubject 主题
     * @return 结果
     */
    @Override
    public int insertTCfgSubject(TCfgSubject tCfgSubject)
    {
        tCfgSubject.setCreateTime(DateUtils.getNowDate());
        return tCfgSubjectMapper.insertTCfgSubject(tCfgSubject);
    }

    /**
     * 修改主题
     *
     * @param tCfgSubject 主题
     * @return 结果
     */
    @Override
    public int updateTCfgSubject(TCfgSubject tCfgSubject)
    {
        tCfgSubject.setUpdateTime(DateUtils.getNowDate());
        return tCfgSubjectMapper.updateTCfgSubject(tCfgSubject);
    }

    /**
     * 批量删除主题
     *
     * @param ids 需要删除的主题主键
     * @return 结果
     */
    @Override
    public int deleteTCfgSubjectByIds(Long[] ids)
    {
        return tCfgSubjectMapper.deleteTCfgSubjectByIds(ids);
    }

    /**
     * 删除主题信息
     *
     * @param id 主题主键
     * @return 结果
     */
    @Override
    public int deleteTCfgSubjectById(Long id)
    {
        return tCfgSubjectMapper.deleteTCfgSubjectById(id);
    }

    /**
     * 根据网点编码 查询主题
     *
     * @param branchCode 主题主键
     * @return 主题
     */
    @Override
    public List<TCfgSubject> selectTCfgSubjectByBranchCode(String branchCode) {
        return tCfgSubjectMapper.selectTCfgSubjectByBranchCode(branchCode);
    }
    @Override
    public List<TCfgSubject> selectTCfgSubjectByBranchCodeAndSystemType(String branchCode,String systemType) {
        return tCfgSubjectMapper.selectTCfgSubjectByBranchCodeAndSystemType(branchCode,systemType);
    }

    @Override
    public int updateTCfgSubjectSortWhenSubjectCode(TCfgSubject tCfgSubject) {
        return tCfgSubjectMapper.updateTCfgSubjectSortWhenSubjectCode(tCfgSubject);
    }
}
